package cn.webrx;

import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Stream1 {
    public static void main(String[] args) {
        //IntStream is = IntStream.range(1,5)
        IntStream is = IntStream.rangeClosed(1, 100);
        //System.out.println(is.sum());
        int sum = is.filter(e -> e % 2 == 0).sum();
        System.out.printf("1+2+3+...+100=%d", sum);


        System.out.println();
        Stream<User> su = Stream.of(new User(1,"李四",25),new User(2,"张三丰",95),new User(3,"李丽",55));
        su.map(s->{
            if(s.getName().startsWith("李")){
                s.setScore(s.getScore()+10);
            }
            return s;
        }).forEach(System.out::println);

       //su.forEach(System.out::println);

    }
}
